package com.zjsystem.zjsy.controller;


import com.zjsystem.zjsy.result.Result;
import com.zjsystem.zjsy.service.ZjxdOrgService;
import com.zjsystem.zjsy.vo.Node;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 系统组织表 前端控制器
 * </p>
 *
 * @author wyf
 * @since 2024-07-11
 */
@RestController
@RequestMapping("/zjsy/zjxOrg")
public class ZjxdOrgController {
    @Resource
    private ZjxdOrgService orgService;

    @ApiModelProperty("获取组织树")
    @GetMapping("/getTree")
    public Result getTree() {
        try {
            Node tree = orgService.getOrgsTree(orgService.list());
            return Result.ok(tree);
        } catch (Exception e) {
            return Result.fail().message("获取组织树异常");
        }
    }

}

